@extends('Layouts.iframe')
@section('content')
    <style>
        .title_{
            width: 100px;
            text-align: center;
            height: 30px;
            line-height: 30px;
            border: 1px solid #999;
            border-radius: 6px;
        }
        .msg_block{
            margin-bottom: 30px;
        }
        .tag_box{
            margin: 20px 0;
        }
        .tag_box a{
            margin: 0.5%;
        }
        input.btn_{
            display: block;
            width: 120px;
            margin: auto;
            height: 40px;
        }
        .select-box{
            line-height: 29px;
        }
        .title_{
            width: 100px;
            text-align: center;
            height: 30px;
            line-height: 30px;
            border: 1px solid #999;
            border-radius: 6px;
        }
        .msg_block{
            margin-bottom: 30px;
        }
        .tag_box{
            margin: 20px 0;
        }
        .select-box{
            line-height: 29px;
        }
        .tag-row{
            padding-left: 5%;
        }
        .tag-row div{
            margin: 1% 0;
        }
        .input-text[type="number"]{
            width: 120px;
        }
        .col-sm-6{
            line-height: 2.5;
        }
    </style>

    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span> <a href="{{url('admin/product')}}" style="text-decoration: none">产品管理</a>
        <span class="c-gray en">&gt;</span> 产品添加
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>

    <div class="page-container">
        <form action="javascript:void(0)" method="post" class="form form-horizontal" id="form-product-add" enctype="multipart/form-data">
            <input type="hidden" name="_token" value="{{csrf_token()}}">
            <div class="msg_block">
                <p class="title_">基本信息</p>
                <div class="row cl">
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>产品名称：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="" maxlength="20" placeholder="" id="" name="name">
                            </div>
                        </div>
                    </div>
                    <p class="col-xs-12 col-sm-12" style="margin:0;"></p>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>产品类型：</label>
                            <div class="formControls col-xs-4 col-sm-4">
                                <span class="select-box">
                                <select name="basic_info[category_id_first]" id="category_id_first" class="select">
                                    <option value="">请选择一级类型 </option>
                                    <?php $categories=\App\Models\Dictionary::select('id','name')->where(['pid'=>1])->get();?>
                                    @if($categories->count())
                                        @foreach($categories as $category)
                                            <option value="{{$category->id}}">{{$category->name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                                </span>
                            </div>
                            <div class="formControls col-xs-4 col-sm-4">
                                <span class="select-box">
                                <select name="basic_info[category_id_second]" id="category_id_second" class="select">
                                    <option value="">请选择二级类型 </option>
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属机构：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[agent_id]" class="select">
                                    <option value="">请选择机构 </option>
                                    <?php $agents=\App\Models\Agent::select('id','name')->get();?>
                                    @if($agents->count())
                                        @foreach($agents as $agent)
                                            <option value="{{$agent->id}}">{{$agent->name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>放款额度：</label>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="8"  class="input-text" min="1" max="1000" value="" placeholder="" id="" name="basic_info[loan_start]" onkeyup="if( ! /^-?\d+\.?\d{0,2}$/.test(this.value)){ var s = this.value;this.value=s.substring(0,s.length-1);}" onblur="value=value.replace(/[^\d\.]/g,'')">
                            </div>
                            <div class="formControls col-xs-1 col-sm-1" style="text-align: center">
                                至
                            </div>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="8" class="input-text" min="1" max="1000" value="" placeholder="" id="" name="basic_info[loan_end]" onkeyup="if( ! /^-?\d+\.?\d{0,2}$/.test(this.value)){ var s = this.value;this.value=s.substring(0,s.length-1);}" onblur="value=value.replace(/[^\d\.]/g,'')">
                            </div>
                            <div class="formControls col-xs-2 col-sm-2">
                                (万)
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>年龄要求：</label>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3" step="1" class="input-text" value="" placeholder="" id="" name="basic_info[age_start]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-1 col-sm-1" style="text-align: center">
                                至
                            </div>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3"  step="1" class="input-text" value="" placeholder="" id="" name="basic_info[age_end]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-2 col-sm-2">
                                (岁)
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>还款期限：</label>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3" class="input-text" value="" placeholder="" id="" name="basic_info[repay_start]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-1 col-sm-1" style="text-align: center">
                                至
                            </div>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3" class="input-text" value="" placeholder="" id="" name="basic_info[repay_end]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-2 col-sm-2">
                                (月)
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>还款方式：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[repay_type]" class="select">
                                    <option value="">请选择还款方式 </option>
                                    <?php $repays=\App\Models\Dictionary::select('id','name')->where(['pid'=>2])->get();?>
                                    @if($repays->count())
                                        @foreach($repays as $repay)
                                            <option value="{{$repay->id}}">{{$repay->name}}</option>
                                        @endforeach
                                    @endif
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>月利率：</label>
                            <div class="formControls col-xs-3 col-sm-3">
                                {{--<input type="number" step="0.01"  class="input-text" value="" placeholder="" id="" name="basic_info[rate_start]" onkeyup="value=value.replace(/[^\d\.]/g,'')" onblur="value=value.replace(/[^\d\.]/g,'')">--}}
                                <input type="tel" maxlength="5"  class="input-text" value="" placeholder="" id="" name="basic_info[rate_start]" onblur="value=value.replace(/[^\d\.]/g,'')" onkeyup="if( ! /^-?\d+\.?\d{0,2}$/.test(this.value)){ var s = this.value;this.value=s.substring(0,s.length-1);}">
                            </div>
                            <div class="formControls col-xs-1 col-sm-1" style="text-align: center">
                                至
                            </div>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="5" class="input-text" value="" placeholder="" id="" name="basic_info[rate_end]" onkeyup="if( ! /^-?\d+\.?\d{0,2}$/.test(this.value)){ var s = this.value;this.value=s.substring(0,s.length-1);}" onblur="value=value.replace(/[^\d\.]/g,'')">
                            </div>
                            <div class="formControls col-xs-2 col-sm-2">
                                (%)
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>区域：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="" maxlength="20" placeholder="" id="" name="basic_info[area]">
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>放贷进度：</label>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3" class="input-text" value="" placeholder="" id="" name="basic_info[progress_start]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-1 col-sm-1" style="text-align: center">
                                至
                            </div>
                            <div class="formControls col-xs-3 col-sm-3">
                                <input type="tel" maxlength="3" class="input-text" value="" placeholder="" id="" name="basic_info[progress_end]" onkeyup="value=value.replace(/[^\d]/g,'')" onblur="value=value.replace(/[^\d]/g,'')">
                            </div>
                            <div class="formControls col-xs-2 col-sm-2">
                                (工作日)
                            </div>
                        </div>
                    </div>
                    <p class="col-xs-12 col-sm-12" style="margin:0;"></p>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3">白户要求：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[require_white]" class="select">
                                    <option value="0">无要求 </option>
                                    <option value="1">不做白户</option>
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3">工作地：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[require_workplace]" class="select">
                                    <option value="0">无要求 </option>
                                    <option value="1">要求在申请地工作</option>
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3">房产要求：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[require_house]" class="select">
                                    <option value="0">无要求 </option>
                                    <option value="1">要求申请地房产</option>
                                    <option value="2">有房产即可</option>
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-3">居住地：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="select-box">
                                <select name="basic_info[require_live]" class="select">
                                    <option value="0">无要求 </option>
                                    <option value="1">要求在申请地居住</option>
                                </select>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="msg_block">
                <p class="title_"><span class="c-red" style="margin-right: 5px">*</span>申请条件</p>
                <div class="row cl">
                    {{--<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>申请条件：</label>--}}
                    <div class="formControls col-xs-8 col-sm-9 col-sm-offset-1">
                        <textarea oninput="limit_letter(this)" maxlength="1000" name="apply_condition" cols="" rows="" class="textarea"  placeholder="请输入进件条件，包含资产  房产  保单  区域 户口  三非 负债  收入认定 征信等" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,1000)"></textarea>
                        <p class="textarea-numberbar"><em class="textarea-length">0</em>/1000</p>
                    </div>
                </div>
            </div>

            <div class="msg_block">
                <p class="title_"><span class="c-red" style="margin-right: 5px">*</span>所需资料</p>
                <div class="row cl">
                    {{--<label class="form-label col-xs-4 col-sm-2">所需资料：</label>--}}
                    <div class="formControls col-xs-8 col-sm-9 col-sm-offset-1">
                        <textarea oninput="limit_letter(this)" maxlength="1000" name="apply_material" cols="" rows="" class="textarea"  placeholder="请输入所需资料" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,1000)"></textarea>
                        <p class="textarea-numberbar"><em class="textarea-length">0</em>/1000</p>
                    </div>
                </div>
            </div>

            <div class="msg_block">
                <p class="title_">注意事项</p>
                <div class="row cl">
                    {{--<label class="form-label col-xs-4 col-sm-2">注意事项：</label>--}}
                    <div class="formControls col-xs-8 col-sm-9 col-sm-offset-1">
                        <textarea oninput="limit_letter(this)" maxlength="1000" name="apply_tip" cols="" rows="" class="textarea"  placeholder="请输入产品说明  费用  及注意事项" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,1000)"></textarea>
                        <p class="textarea-numberbar"><em class="textarea-length">0</em>/1000</p>
                    </div>
                </div>
            </div>

            <div class="msg_block">
                <p class="title_">产品标签</p>
                <div class="formControls col-xs-12 col-sm-12 label-container tag_box">
                    {{--<a class="btn btn-success radius" href="javascript:;">--}}
                        {{--<span>标签1</span>--}}
                        {{--<input type="hidden" name="tag_ids[]['id']" class="tag_hidden" value="">--}}
                        {{--<input type="hidden" name="tag_ids[]['name']" class="" value="">--}}
                    {{--</a>--}}
                </div>
                <p><a href="javascript:;" onclick="label_add()" style="color:#06c;">管理产品标签</a></p>
            </div>

            <div class="msg_block">
                <p class="title_">状态：</p>
                <div class="row cl">
                    <div class="formControls col-xs-8 col-sm-9 skin-minimal col-sm-offset-1">
                        <div class="radio-box">
                            <input name="status" type="radio" id="status-up" value="1">
                            <label for="status-up">上架</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" name="status" id="status-down" value="0">
                            <label for="status-down">下架</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="msg_block">
                <div class="row cl">
                    <div class="formControls col-xs-12 col-sm-12 skin-minimal">
                        <div class="check-box">
                            <input type="checkbox" id="checkbox-1" name="is_hot" value="1">
                            <label for="checkbox-1">标记为热门</label>
                        </div>
                    </div>
                </div>
            </div>
            @can('product.store')
                <div class="row cl">
                    <div class="col-xs-8 col-sm-8 col-sm-offset-1">
                        <input class="btn_ btn btn-success radius" type="submit" id="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                    </div>
                </div>
            @endcan
    </form>
</div>
    <div class="tag-hidden" style="display: none">
        <div class="page-container">
            <form action="javascript:void(0);" method="post" class="form form-horizontal" id="form-tag-add" enctype="multipart/form-data">
                <div class="msg_block">
                    <?php $tags=\App\Models\Tag::select()->with(['child'=>function($query){$query->select()->get();}])->where(['pid'=>0])->get();?>
                    @if($tags->count())
                        @foreach($tags as $tag)
                            <div class="row cl">
                                <div class="formControls col-xs-12 col-sm-12 skin-minimal2" style="margin-bottom:10px;">
                                    <div class="check-box">
                                        <input type="checkbox" id="checkbox-{{$tag->id}}" class="all">
                                        <label for="checkbox-{{$tag->id}}">{{$tag->name}}</label>
                                    </div>
                                </div>
                                @if($tag->child->count())
                                    <div class="formControls col-xs-12 col-sm-12 skin-minimal2 tag-row">
                                        @foreach($tag->child as $child)
                                            <div class="check-box">
                                                <input type="checkbox" id="checkbox-child-{{$child->id}}" value="{{$child->id}}" data-name="{{$child->name}}" class="child">
                                                <a class="btn btn-success radius" href="javascript:;">{{$child->name}}</a>
                                            </div>
                                        @endforeach
                                    </div>
                                @endif
                            </div>
                        @endforeach
                    @endif
                </div>
            </form>
        </div>
    </div>
@endsection
@section('js')
    <script>
        /*字数限制*/
        function limit_letter(obj) {
            var length=$(obj).val().length;
            $(obj).closest('div').find('.textarea-length').html(length);

        }


        /*标签-添加/编辑*/
        function label_add(){
           var content='<div id="tag-pop">'+$('.tag-hidden').html()+'</div>';
           layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['800px', '550px'], //宽高
                title:'添加标签',
                content: content,
                btn:['确认','取消'],
                success:function (layero,index) {

                    $('#tag-pop .skin-minimal2 input').iCheck({
                        checkboxClass: 'icheckbox-blue',
                        radioClass: 'iradio-blue',
                        increaseArea: '20%'
                    });
                    var flag=0;
                    $('.all').on('ifClicked',function () {
                       flag=0;
                    });
                    //全选
                    $('.all').on('ifChecked',function () {
                        $(this).closest('.row').find('.tag-row').find('input[type="checkbox"]').iCheck('check');
                    });
                    //反选
                    $('.all').on('ifUnchecked',function () {
                        if(flag===0){
                            $(this).closest('.row').find('.tag-row').find('input[type="checkbox"]').iCheck('uncheck');
                        }
                    });
                    //单个选中
                    $('.child').on('ifChecked',function () {
                        if($(this).closest('.row').find('.child').length==$(this).closest('.row').find('.child:checked').length){
                            $(this).closest('.row').find('.all').iCheck('check');
                        }
                    });
                    //单个取消选中
                    $('.child').on('ifUnchecked',function () {
                        flag=1;
                        $(this).closest('.row').find('.all').iCheck('uncheck');
                    });

                    //再次点击回显上次选中
                    $('body').find('.tag_hidden').each(function (key,dom) {
                        $('#tag-pop .skin-minimal2').find('input[value="'+$(dom).val()+'"]').iCheck('check');
                    })
                },
               yes:function (index,layero) {
                    var html='<div id="tagIds">';
                   $('.child:checked').each(function (key,value) {
                        var id=$(value).val();
                        var name=$(value).data('name');
                        html +='<a class="btn btn-success radius" href="javascript:;">\n' +
                            '                        <span>'+name+'</span>\n' +
                            '                        <input type="hidden" name="tag_ids['+key+'][id]" class="tag_hidden" value="'+id+'">\n' +
                            '                        <input type="hidden" name="tag_ids['+key+'][name]" class="" value="'+name+'">\n' +
                            '                    </a>';
                   });
                   html +='</div>';
                   $('.tag_box').html(html);
                   layer.close(index);
               }
            });
        }
        
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        /*一级分类联动二级分类*/
        $("#category_id_first").on('change',function () {
            var html="<option value=''>请选择二级类型</option>";
            var id=$(this).val();
            if(!id){
                $("#category_id_second").html(html);
                return false;
            }
            var _token="{{csrf_token()}}";
            $.post("{{url('admin/getSecondCategory')}}",{'_token':_token,'id':id},function (data) {
                if(data.length>0){
                    $.each(data,function (key,value) {
                        html += "<option value='"+value.id+"'>"+value.name+"</option>";
                    });
                }
                $("#category_id_second").html(html);
            });
        });


        $.extend($.validator.messages, {
            required: "必填"
        });

        /*提交*/
        $("#form-product-add").validate({
            rules:{
                name:{
                    required:true,
                    maxlength:20
                },
                'basic_info[category_id_first]':{
                    required:true
                },
                'basic_info[agent_id]':{
                    required:true
                },
                'basic_info[loan_start]':{
                    required:true,
                    min:1,
                    max:10000
                },
                'basic_info[loan_end]':{
                    required:true,
                    min:1,
                    max:10000
                },
                'basic_info[age_start]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                'basic_info[age_end]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                'basic_info[repay_start]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                'basic_info[repay_end]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                'basic_info[repay_type]':{
                    required:true
                },
                'basic_info[rate_start]':{
                    required:true,
                    min:0,
                    max:100
                },
                'basic_info[rate_end]':{
                    required:true,
                    min:0,
                    max:100
                },
                'basic_info[area]':{
                    required:true
                },
                'basic_info[progress_start]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                'basic_info[progress_end]':{
                    required:true,
                    min:1,
                    max:100,
                    digits:true
                },
                apply_condition:{
                    required:true
                },
                apply_material:{
                    required:true
                }
            },
            onkeyup:false,
//            focusCleanup:false,
            success:"valid",
            submitHandler:function(form){
                if(parseFloat($('input[name="basic_info[loan_start]"]').val())>parseFloat($('input[name="basic_info[loan_end]"]').val())){
                    layer.msg('放款额度前值不能比后值大');return false;
                }
                if(parseFloat($('input[name="basic_info[age_start]"]').val())>parseFloat($('input[name="basic_info[age_end]"]').val())){
                    layer.msg('年龄要求前值不能比后值大');return false;
                }
                if(parseFloat($('input[name="basic_info[repay_start]"]').val())>parseFloat($('input[name="basic_info[repay_end]"]').val())){
                    layer.msg('还款期限前值不能比后值大');return false;
                }
                if(parseFloat($('input[name="basic_info[rate_start]"]').val())>parseFloat($('input[name="basic_info[rate_end]"]').val())){
                    layer.msg('利率前值不能比后值大');return false;
                }
                if(parseFloat($('input[name="basic_info[progress_start]"]').val())>parseFloat($('input[name="basic_info[progress_end]"]').val())){
                    layer.msg('放款进度前值不能比后值大');return false;
                }
                $.post("{{route('product.store')}}", $('#form-product-add').serializeArray(), function (res) {
                    layer.msg(res.msg,{icon:1,time:1000});
                    if (res.status === 200) {
                        setTimeout(function () {
                            window.location.href="{{route('product.index')}}";
                        },1000);
                    }
                }).fail(function (data) {
                    var errors=$(JSON.parse(data.responseText))[0].errors;
                    $.each(errors, function (key, value) {
                        console.log(value);
                        layer.msg(value[0],{icon:1,time:1000});
                    });
                });
            }
        });
    </script>
@endsection
